
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 2824
 * @Author : WangRuoyu 
 * @Date : 2023/9/3 16:19
 */

#include "iostream"
#include "vector"

using namespace std;

class Solution {
public:
    int countPairs(vector<int> &nums, int target) {
        int res = 0;
        for (int i = 0; i < nums.size(); ++i) {
            for (int j = i + 1; j < nums.size(); ++j) {
                if (nums[i] + nums[j] < target) res++;
            }
        }
        return res;
    }
};

int main() {
    Solution sl;
    vector<int> nums = {-1, 1, 2, 3, 1};
    int target = 2;
    cout << sl.countPairs(nums, target);
    return 0;
}